import { UPDATEPAGESELFMESSAGE } from '../types/pageselfmessage'
import { handleActions } from 'redux-actions'
import { formatDate } from '../../../../util/lodashmin/formatDate'

const end = formatDate('', 'YYYY-MM-DD')
const Schema = {
  showEmpty: false,
  requestOverFirst: false,
  networkerror: false,
  submitdata: {
    name: '',
    sex: '1',
    birthday: '',
    phone: ''
  },
  sexlist: [{ name: 'boy', value: '1' }, { name: 'girl', value: '2' }],
  selectdatalist: [
    {
      mode: 'date',
      name: '出生年份',
      end: end,
      type: 'birthday',
      fields: 'year',
      value: ''
    },
    {
      name: '手机号',
      type: 'phone',
      value: ''
    }
  ],
  modalVisible: false
}

export default handleActions(
  {
    [UPDATEPAGESELFMESSAGE](state, action) {
      return {
        ...state,
        ...action.payload
      }
    }
  },
  Schema
)
